

/*
 *    project:Default (Template) Project   package:
 *    user:13004
 *    2024/10/16 下午8:52
 */


import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;

public class Main {
    public static void main(String[] args) {
        LocalDateTime time = LocalDateTime.now();
        System.out.println(time);

        LocalDate localDate = time.toLocalDate();
        System.out.println(localDate);

        LocalTime localTime = time.toLocalTime();
        System.out.println(localTime);

        int hour = localTime.getHour();
        int minute = localTime.getMinute();
        int second = localTime.getSecond();
        System.out.println(hour + ":" + minute + ":" + second);

        Instant now = Instant.now();
        System.out.println(now);
    }
}